<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">


<ui:composition template="/templates/internal.xhtml">
	<ui:define name="center">
		<script type="text/javascript">
			$( document ).ready(function() {
				wlayout.layout.hide('south');
				if((#{p:ifAnyGranted('ROLE_ADMIN')})){
					wlayout.layout.open('west');
				}else{
					wlayout.layout.hide('west');
				}
			});			
		</script>
		<p:outputPanel id="content" layout="block" style="height:100%;width:100%">
			<ui:include src="/personalTrainer/personalTrainerForm.xhtml"/>
		</p:outputPanel>
	</ui:define>
	<ui:define name="menu">
		<h:form id="listPersonalTrainerForm" prependId="false" rendered="#{p:ifAnyGranted('ROLE_ADMIN')}">
			<p:dataTable id="personalTrainersTable" value="#{personalTrainerBean.personalTrainers}" var="personalTrainer" paginator="true"  paginatorAlwaysVisible="false"  paginatorPosition="bottom" rows="15" emptyMessage="#{msgs.NoResults}">
				<p:columnGroup type="header">  
					<p:row>
						<p:column colspan="4">
							<f:facet name="header">
								<h:outputText value="#{msgs.PersonalTrainers}" />
							</f:facet>
						</p:column>
						<p:column colspan="1" styleClass="ui-table-button-row">
							<f:facet name="header">
								<p:commandButton title="#{msgs.Filter}" icon="ui-icon-search" onclick="wfindPersonalTrainer.show()" styleClass="ui-table-button"/>
							</f:facet>
						</p:column>
					</p:row>
					<p:row>
						<p:column colspan="1" styleClass="ui-table-button-row">
							<f:facet name="header">
								<p:commandButton title="#{msgs.Add}"	action="#{personalTrainerBean.toAddPersonalTrainer}" update=":content"	 icon="ui-icon-plus" styleClass="ui-table-button"/>
							</f:facet>
						</p:column>
						<p:column	colspan="4">
							<f:facet name="header">
								<h:outputText value="#{msgs.Name}"/>
							</f:facet>
						</p:column>
					</p:row>	
				</p:columnGroup>
				<p:column colspan="3" headerText="#{msgs.Name}" >
					<h:outputText value="#{personalTrainer.firstName} #{personalTrainer.lastName} " />
				</p:column>
				<p:column colspan="1" styleClass="ui-widget-header ui-table-button-row"  >
					<p:commandButton title="#{msgs.View}" action="#{personalTrainerBean.toViewPersonalTrainer}"  icon="ui-icon-search"  styleClass="ui-table-button" update=":content">
						<f:setPropertyActionListener target="#{personalTrainerBean.personalTrainer}" value="#{personalTrainer}"/>
					</p:commandButton>
				</p:column>
				<p:column colspan="1" styleClass="ui-widget-header ui-table-button-row" >
					<p:commandButton title="#{msgs.Delete}" process="@this" onclick="wconfExcPersonalTrainer.show();"  icon="ui-icon-trash" styleClass="ui-table-button" >
						<f:setPropertyActionListener target="#{personalTrainerBean.personalTrainer}" value="#{personalTrainer}"/> 
					</p:commandButton>
				</p:column>		
			</p:dataTable>			
		</h:form>
	</ui:define>

	<ui:define name="dialogs">
		<ui:include src="/personalTrainer/personalTrainerDialogs.xhtml"/> 
	</ui:define>
</ui:composition>
	
</html>